%%%% function values K_1 - B_e_0 / (1 - par.phi)
%%%% the values should be zero at cutoffs

function fval = cut_off_PSI(PSI, B_e_0, par, indicator)

% using the constrained / or unconstrained function
if strcmp(indicator, 'constrained')
    K_1 = ((1 + PSI) / (1 + (1 + par.NU) * PSI) * par.A * (1 - par.ALPHA) / par.MU)^(1 / par.NU) *...
        ( ((par.phi + PSI) / par.phi / (1 + PSI) / par.BETA - (1 - par.DELTA)) / par.A / par.ALPHA )^((par.ALPHA + par.NU) / par.NU / (par.ALPHA - 1));
else
    K_1 = ((1 + PSI) / (1 + (1 + par.NU) * PSI) * par.A * (1 - par.ALPHA) / par.MU)^(1 / par.NU) *...
        ( (1 / par.BETA - (1 - par.DELTA)) / par.A / par.ALPHA )^((par.ALPHA + par.NU) / par.NU / (par.ALPHA - 1));
end
fval = K_1 - B_e_0 / (1 - par.phi);

end